package br.edu.fucapi.pos.model.bean;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "balancete")
public class Balancete {
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id", nullable = false)
	private Integer id;
	
	@Column(name = "mes", nullable=false)
	private String mes;
	
	@Column(name = "dataInclusao", nullable=false)
	//somente dataInclusao, sem hora
	@Temporal(TemporalType.DATE)
	private Calendar dataInclusao = Calendar.getInstance();
	
	@OneToMany(mappedBy="balancete")
	private List<ItemPrestacaoContas> itens = new ArrayList<ItemPrestacaoContas>();
	
	public Balancete() {
		itens = new ArrayList<ItemPrestacaoContas>();
	}
	
	public void adicionarItem(ItemPrestacaoContas itemPrestacaoContas) {
		this.itens.add(itemPrestacaoContas);
	}
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getMes() {
		return mes;
	}
	public void setMes(String mes) {
		this.mes = mes;
	}
	public Calendar getDataInclusao() {
		return dataInclusao;
	}
	public void setDataInclusao(Calendar dataInclusao) {
		this.dataInclusao = dataInclusao;
	}
	public List<ItemPrestacaoContas> getItens() {
		return itens;
	}
	public void setItens(List<ItemPrestacaoContas> itens) {
		this.itens = itens;
	}
}
